package com.zzy.database.utils;



import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;

import java.util.Date;
import java.util.Map;

public class Jwtutil {
    public static String genToken(Map<String,Object> claims){
        return JWT.create().withClaim("claims",claims).withExpiresAt(new Date(System.currentTimeMillis()+3600000L)).sign(Algorithm.HMAC256("itheima"));
    }
    public static Map<String, Object> parseToken(String token) {
        return JWT.require(Algorithm.HMAC256("itheima")).build().verify(token).getClaim("claims").asMap();
    }
}
